const { Model, DataTypes } = require('sequelize')

class Article extends Model {
  static init(sequelize) {
    super.init(
      {
        title: {
          type: DataTypes.STRING,
          allowNull: false,
        },
        content: {
          type: DataTypes.TEXT,
          allowNull: false,
        },
        createdAt: {
          type: DataTypes.DATE,
          allowNull: true,
        }
      },
      {
        sequelize,
        modelName: 'Article',
        tableName: 'articles',
        timestamps: false, // 确保启用时间戳（默认值为 true）
      }
    );
  }

  static associate(models) {
    // 定义关联关系
  }
}

module.exports = Article